from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from testudo import *
from testudo.framework import *
from testudo.writer_classes import *
import os
import traceback
import types

class SimpleHandler(webapp.RequestHandler):
	def get(self):
		result = SuiteRunner(['tests']).run()
		SimpleWriter(self.response).write(result)
		
class TestudoHandler(webapp.RequestHandler):
	def get(self):
		action = self.request.get('action')
		if (action == 'json'):
			result = SuiteRunner(['tests']).run()
			JSONWriter(self.response).write(result)
		else:
			template_values = { }
			path = os.path.join(os.path.dirname(__file__), 'gui/client.html')
			self.response.out.write(template.render(path, template_values))
			